<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="../../libs/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../../libs/app.css"/>
    <link rel="stylesheet" href="../../css/mui.listpicker.css"/>
    <link rel="stylesheet" href="../../css/mui.poppicker.css"/>
    <link rel="stylesheet" href="../../css/main.css"/>
    <link rel="stylesheet" href="../../css/askfor.css"/>
</head>

<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>申请信息</p>
</div>
<div class="context2">
    <div class="state">
        <div><span class="one">1</span>
            <p>服务商选择</p>
        </div>
        <div><span style="background-color: white;color: black;" class="two">2</span>
            <p>申请人信息</p>
        </div>
        <div><span class="three">3</span>
            <p>申请结果</p>
        </div>
        <img class="gang1" src="../../images/white-gang.png" alt="">
        <img class="gang2" src="../../images/white-gang.png" alt="">
    </div>
    <div class="message">
        <div>
            <p>姓名</p>
            <input class="name" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>身份证号</p>
            <input class="card" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>职业信息</p>
            <select id="wordinfo">
                <option value="">请选择</option>
                <option value="医生">医生</option>
                <option value="教师">教师</option>
                <option value="公务员">公务员</option>
                <option value="企业主">企业主</option>
                <option value="个体户">个体户</option>
                <option value="上班族">上班族</option>
                <option value="事业单位">事业单位</option>
                <option value="自雇人士">自雇人士</option>
            </select>
        </div>
        <div>
            <p>税前收入</p><span>万元</span>
            <input class="income" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>借款金额</p><span>万元</span>
            <input class="price" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>借款期限</p>
            <select id="date">
                <option value="">请选择</option>
                <option value="6期">6期</option>
                <option value="12期">12期</option>
                <option value="24期">24期</option>
                <option value="36期">36期</option>
            </select>
        </div>
        <div>
            <p>信用状况</p>
            <select id="credit">
                <option value="">请选择</option>
                <option value="一年内逾期超过3次或超过90天" title="一年内逾期超过3次或超过90天">一年内逾期超过3次或超过90天</option>
                <option value="一年内逾期少于3次或少于90天" title="一年内逾期少于3次或少于90天">一年内逾期少于3次或少于90天</option>
                <option value="无信用卡或无贷款" title="无信用卡或无贷款">无信用卡或无贷款</option>
                <option value="信用良好，无逾期" title="信用良好，无逾期">信用良好，无逾期</option>
            </select>
            <!--<input class="credit" type="text" placeholder="单行输入">-->
        </div>

        <div>
            <p style="">是否有房产</p>
            <select class="haveHouse">
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
        <div>
            <p>房产类别</p>
            <!--<input class="houseType" type="text" placeholder="单行输入">-->
            <select class="houseType">
                <option value="">请选择</option>
                <option value="商品楼">商品楼</option>
                <option value="写字楼">写字楼</option>
                <option value="商铺">商铺</option>
                <option value="工业厂房">工业厂房</option>
            </select>
        </div>
        <div>
            <p>房产楼龄</p><span>年</span>
            <input class="houseAge" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>房产地点</p>
            <input class="houseLoc" type="text" placeholder="单行输入">
        </div>
        <div id='showCityPicker3' class="mui-btn mui-btn-block">
            <p>申请地点</p>
            <i class="icon-editCity"></i>
            <input readonly="true" id='cityResult3' class="ui-alert area" placeholder="请选择" type="text"/>
        </div>
        <div class="select">
            <p style="">房款是否已结清</p>
            <select class="whole">
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>

    </div>
    <!--<div class="yan">
        <div class="yan-input"><input type="text" placeholder=""></div>
        <div><button>获取验证码</button></div>
        <img src="../../images/yan.png" alt="">
    </div>-->
    <div class="button">
        <button id="askfor3">下一步</button>
    </div>
</div>

<script src="../../js/jquery-3.1.1.min.js"></script>
<script src="../../libs/mui.min.js"></script>
<script src="../../js/url.js"></script>
<script src="../../js/city-data-3.js"></script>
<script src="../../js/mui.listpicker.js"></script>
<script src="../../js/mui.poppicker.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=AIEts6CoFGpdivbIz3uI3SrAG9iDB0Ko"></script>
<script src="../../js/location.js"></script>
<script src="../../js/city-public.js"></script>
<script>
    var freeService = localStorage.fuwu;
    var token = localStorage.token;
    //接口
    $('#askfor3').on('tap', function () {
        var name = $('.name').val();
        var card = $('.card').val();
        var work = $('#wordinfo').val();
        var income = $('.income').val();
        var price = $('.price').val();
        var date = $('#date').val();
        var credit = $('#credit').val();

        var haveHouse = $('.haveHouse').val();
        var houseType = $('.houseType').val();
        var houseAge = $('.houseAge').val();
        var houseLoc = $('.houseLoc').val();
        var area = $('.area').val();
        var whole = $('.whole').val();
        console.log('{"name":"' + name + '","id_card":"' + card + '","work":"' + work + '","income":"' + income + '","price":"' + price + '","date":"' + date + '","credit":"' + credit +
            '","haveHouse":"' + haveHouse + '","houseType":"' + houseType + '","houseAge":"' + houseAge + '","houseLoc":"' + houseLoc + '","area":"' + area + '","whole":"' + whole + '","freeService":"' + freeService + '"}')
        var hanzi = /^[\u4e00-\u9fa5]{0,}$/;
        var sfzh = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
        var shouru = /^[0-9]+(.[0-9]{3})?$/;
        if ((!hanzi.test(name)) || name == '') {
            mui.toast('请检查您的姓名');
            return;
        } else if ((!sfzh.test(card)) || card == '') {
            mui.toast('请检查您的身份证号');
            return;
        } else if ((!shouru.test(income)) || income == '') {
            mui.toast('请检查您的月收入');
            return;
        } else if ((!shouru.test(price)) || price == '') {
            mui.toast('请检查您的借款金额');
            return;
        } else if (work == '' || date == '' || credit == '' || area == '' || houseType == '' || houseAge == '' || houseLoc == '') {
            mui.toast('请检查您输入的信息');
            return;
        } else {
            if (localStorage.dk_type == 2) {
                b();
            } else {
                a();
            }

        }

        function a() {

            $.ajax({
                url: ur + 'rest/loanController/request',
                type: "post",
                dataType: "json",
                headers: {
                    "X-Token": token
                },
                data: {
                    loanCode: 'fcdy',
                    evaluateId: localStorage.evaluateId,
                    point: (localStorage.locationPoint ? localStorage.locationPoint : ''), // 坐标
                    params: '{"name":"' + name + '","id_card":"' + card + '","work":"' + work + '","income":"' + income + '","price":"' + price + '","date":"' + date + '","credit":"' + credit +
                    '","haveHouse":"' + haveHouse + '","houseType":"' + houseType + '","houseAge":"' + houseAge + '","houseLoc":"' + houseLoc + '","area":"' + area + '","whole":"' + whole + '","freeService":"' + freeService + '"}'
                },
                success: function (data) {

                    if (data.meta.code === 'S002') {
                        href('askfor3.html', 'askfor3');
                    }
                }
            });
        }

        // 快速贷款
        function b() {
            $.ajax({
                url: ur + 'rest/quickLoanController/quick-request',
                type: "post",
                dataType: "json",
                headers: {
                    "X-Token": token
                },
                data: {
                    loanCode: 'fcdy',
                    partnerId: localStorage.fast_partner,
                    quickId: localStorage.fast_id,
                    evaluateId: localStorage.evaluateId,
                    params: '{"name":"' + name + '","id_card":"' + card + '","work":"' + work + '","income":"' + income + '","price":"' + price + '","date":"' + date + '","credit":"' + credit +
                    '","haveHouse":"' + haveHouse + '","houseType":"' + houseType + '","houseAge":"' + houseAge + '","houseLoc":"' + houseLoc + '","area":"' + area + '","whole":"' + whole + '","freeService":"' + freeService + '"}'
                },
                success: function (data) {
                    if (data.meta.code === 'S002') {
                        href('askfor3.html', 'askfor3');
                    }
                }
            });
        }
    });
</script>
</body>

</html>